/**
 * Copyright 2016 JustWayward Team
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.zhuike.novel.app.ui.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.ViewGroup;

import net.zhuike.novel.app.R;
import net.zhuike.novel.app.bean.CollBookBean;
import net.zhuike.novel.app.manager.SettingManager;
import net.zhuike.novel.app.ui.utils.FormatUtils;
import net.zhuike.novel.app.ui.view.recyclerview.adapter.BaseViewHolder;
import net.zhuike.novel.app.ui.view.recyclerview.adapter.RecyclerArrayAdapter;

/**
 * @author wq.
 * @date 2017/6/13.
 */
public class RecommendGirdAdapter extends RecyclerArrayAdapter<CollBookBean> {
    private Context context;
    public RecommendGirdAdapter(Context context) {
        super(context);
    }
    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new BaseViewHolder<CollBookBean>(parent, R.layout.item_recommend_gird) {
            @Override
            public void setData(final CollBookBean item) {
                super.setData(item);
                holder.setText(R.id.tvRecommendTitle, item.getName());
                if (!SettingManager.getInstance().isNoneCover()) {
                    holder.setRoundImageUrl(R.id.ivRecommendCover,item.getCover(),
                            R.mipmap.cover_default);
                } else {
                    holder.setImageResource(R.id.ivRecommendCover, R.mipmap.cover_default);
                }
            }
        };
    }
}
